//
//  AGLCenterButton.m
//  滴滴快拍
//
//  Created by dllo on 16/5/31.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "AGLCenterButton.h"

@implementation AGLCenterButton



/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubViews];
    }
    return self;
}

- (void)createSubViews{
    
    self.backgroundColor = [UIColor clearColor];
    self.frame = CGRectMake(SCREEN_WIDTH * 0.4, -SCREEN_WIDTH *0.07, SCREEN_WIDTH *0.2, SCREEN_HEIGHT *0.2);
    self.userInteractionEnabled = YES;
    
    //背景
    self.btnBackground = [[BaseImageView alloc] initWithFrame:self.bounds];
    
    //切掉圆角边
    self.btnBackground.layer.masksToBounds = YES;
    self.btnBackground.layer.cornerRadius = SCREEN_WIDTH *0.1;
    self.btnBackground.tag = 1000;
    [self addSubview:self.btnBackground];
    
    //圆圈
    UIImageView *imageC = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH * 0.2, SCREEN_WIDTH *0.2)];
    imageC.image = [UIImage imageNamed:@"tabbar_np_loop"];
    imageC.backgroundColor = [UIColor clearColor];
    [self.btnBackground addSubview:imageC];
    //在btnBackground 这个小框框里的坐标
    imageC.center = CGPointMake(SCREEN_WIDTH*0.1, SCREEN_WIDTH*0.1);
    
    //旋转ImageView
    self.musicBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.musicBtn.backgroundColor = [UIColor clearColor];
    self.musicBtn.frame = CGRectMake(0, 0, SCREEN_WIDTH * 0.15, SCREEN_WIDTH * 0.15);
    self.musicBtn.center = CGPointMake(SCREEN_WIDTH * 0.1, SCREEN_WIDTH * 0.1);
    //切掉圆角边
    self.musicBtn.layer.masksToBounds = YES;
    self.musicBtn.layer.cornerRadius = SCREEN_WIDTH * 0.15 / 2;
    //以后会改
    [self.musicBtn setBackgroundImage:[UIImage imageNamed:@"girledg"] forState:UIControlStateNormal];
    [imageC addSubview:self.musicBtn];
    
    
    //播放按钮
    self.playBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.playBtn.backgroundColor = [UIColor clearColor];
    self.playBtn.frame = CGRectMake(0, 0, SCREEN_WIDTH * 0.15, SCREEN_WIDTH * 0.15);
    self.playBtn.center = CGPointMake(SCREEN_WIDTH * 0.1, SCREEN_WIDTH * 0.1);
    //切掉圆角边
    self.playBtn.layer.masksToBounds = YES;
    self.playBtn.layer.cornerRadius = SCREEN_WIDTH * 0.15 / 2;
    //以后会改
    [self.playBtn setBackgroundImage:[UIImage imageNamed:@"toolbar_play_n_p"] forState:UIControlStateNormal];
    self.playBtn.alpha = 0.6;
    [self.playBtn addTarget:self action:@selector(playMusic:) forControlEvents:UIControlEventTouchUpInside];
    [imageC addSubview:self.playBtn];
    //开启交互
    self.btnBackground.userInteractionEnabled = YES;
    imageC.userInteractionEnabled = YES;
    
    
}




@end
